<template>
  <div>
		<van-nav-bar fixed title="门店订单管理" left-arrow @click-left="$utils.back($route.path)" />
		<div class="has-top order_search bg-white pb-24">
      <div  class="bg-white flex-v-c pos-r">
				<van-field
					v-model="searchKey"
					class="flex-1"
					clearable
					placeholder="请输入房间号/姓名/手机号"
					left-icon="search"
					@click-left-icon="search"
					@keyup.enter="search"
				/>
				<div class="pos-a right-20 fs-26" @click="search">搜索</div>
			</div>
    </div>
		<div class="has-bottom">
			<van-tabs v-model:active="active"  @change="tabChange" >
				<van-tab :title="item.title" v-for="(item,index) in tabs" :key="index">
					<div v-for="(item,index) in list" :key="index">
						<mendianOrder :info="item"></mendianOrder>
					</div>
				</van-tab>			
			</van-tabs>
		</div>
		
  </div>
</template>

<script>
import mendianOrder from 'components/mendianOrder'
import { GetCashierDetailBySn } from 'api/order'
import { GoldplanJs } from 'utils/url.js'
import { CellGroup } from 'vant'
export default {
  components: {
    mendianOrder
  },
  props: {
  },
  data() {
    return {
			tabs:[
				{
					title:'已付款',
					status:0,
				},
				{
					title:'待付款',
					status:1,
				},
				{
					title:'已完成',
					status:2,
				},
			],
			active:0,
			state:0, // 0 全部
			list:[
				{
					id:1,
					shopName:' 小二上新（泉秀店）',
					DetailList:[
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
					],
					status:0, // 已付款
					AddTime:'2022-12-26 12:34',
					PriceSum:288.325
				},
				{
					id:2,
					shopName:' 小二上新（泉秀店）',
					DetailList:[
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
					],
					status:1, // 待付款
					AddTime:'2022-12-26 12:34',
					PriceSum:288.325
				},
				{
					id:3,
					shopName:' 小二上新（泉秀店）',
					DetailList:[
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
					],
					status:2, // 已完成
					AddTime:'2022-12-26 12:34',
					PriceSum:288.325,
				},
			],
			searchKey: '',
			requestData: []
    }
  },
  computed: {

  },
  watch: {

  },
  created() {

  },
  mounted() {
    
  },
  activated() {},
  methods: {
		search() {
      this.resetParams()
      this.requestData.searchKey = this.searchKey
    },
		tabChange(e){
			console.log('e',e)
			this.state = e
		},
		goOrder(){

		},
		goPay(){

		},
		goHome(){
			this.$router.push(`orderMeal/222`)
		},
    GetCashierDetailBySn() {
      const _this = this
      GetCashierDetailBySn(_this.Sn).then(res => {
        if (res) {
          var _data = res.Data
          if (_data.Sn) {
            _data.Sn = _data.Sn.substr(_data.Sn.length - 4)
          }
          _this.orderInfo = _data
        }
      })
    },
    openUserCard() {
      console.log(this.$LocalDomain)
      const url = this.$LocalDomain + '/m/home/union?pm=123&storeId=' + this.orderInfo.StoreId
      console.log(document.referrer)
      if (document.referrer.indexOf('https://payapp.weixin.qq.com/') !== -1) {
        parent.postMessage(JSON.stringify({
          action: 'jumpOut',
          jumpOutUrl: url
        }), 'https://payapp.weixin.qq.com')
      } else {
        window.location.href = url
      }
    }
  }
}
</script>

<style lang="scss" scoped>
	.pos-r{
		height: 64px;
		background: #FFFFFF;
		border-radius: 41px;
		border: 1px solid $primary15;
		padding: 0 10px;
		width: 85%;
		margin: 24px auto 0;
	}
	.pos-a{
		background: $primary15;
		color: #fff;
		padding: 3px 20px;
		border-radius: 20px;
	}
	.van-cell{
		padding: 0 12px;
	}	

</style>
